package com.fenqing.leetcode.code.t400_500;

import com.fenqing.annotations.Execute;
import com.fenqing.core.Topic;

/**
 * @author fenqing
 */
public class Topic485 extends Topic {
    /**
     * 构造器
     *
     * @param input 输入
     */
    public Topic485(String input) {
        super(input);
    }

    @Execute
    public int findMaxConsecutiveOnes(int[] nums) {
        int max = 0, count = 0;
        for (int num : nums) {
            if (num == 1) {
                count++;
            } else {
                if (max < count) {
                    max = count;
                }
                count = 0;
            }
        }
        return Math.max(max, count);
    }

    public static void main(String[] args) {
        Topic485 topic = new Topic485("[0,1]");
        int run = topic.run();
        System.out.println(run);
    }
}
